class Solution {
public:
    vector<vector<int>> generate(int numRows) {
        vector<vector<int>> results(numRows);

        for(int i = 0; i < numRows; ++i)
        {
            for(int j = 0; j <= i; ++j)
            {
                results[i].push_back(1);
            }
        }

        if(numRows >= 3)
        {
            for(int i = 2; i < numRows; ++i)
            {
                for(int j = 1; j < i; ++j)
                {
                    results[i][j] = results[i-1][j-1]+results[i-1][j];
                }
            }
        }

        return results;

    }
};

class Solution {
public:
    int climbStairs(int n) {
        if(n == 1)
            return 1;
        if(n == 2)
            return 2;

        vector<int> dp(n+1,0);
        dp[1] = 1;
        dp[2] = 2;

        for(int i = 3; i <= n; ++i)
        {
            dp[i] = dp[i-1]+dp[i-2];
        }

        return dp[n];
    }
};
